import { ColumnProps } from "@/components/Table/type";
import { SchemaProps } from "@/components/Form/type";
const pageTypeList = [
  { label: "业务页面", value: 1 },
  { label: "流程页面", value: 2 }
];
export const columns: ColumnProps[] = [
  { type: "index", label: "#", width: 50 },
  { prop: "appName", label: "应用名称", search: { el: "input" } },
  {
    prop: "pageType",
    label: "页面类型",
    render: ({ row }) => {
      for (const pageType of pageTypeList) {
        if (pageType.value === row.pageType) {
          return <div>{pageType.label}</div>;
        }
      }
    }
  },
  { prop: "action", label: "操作", width: 150, fixed: "right" }
];

export const basicSchemas: SchemaProps[] = [
  {
    field: "appName",
    label: "应用名称",
    required: true
  },
  {
    field: "pageType",
    label: "页面类型",
    el: "select",
    elProps: {
      options: pageTypeList
    },
    disabled: formModel => !!formModel.id,
    defaultValue: 1,
    required: true
  },
  {
    field: "entityId",
    label: "业务实体",
    required: true
  }
];

export const menuSchemas: SchemaProps[] = [
  {
    field: "pageId",
    label: "在线页面",
    required: true
  },
  {
    field: "icon",
    label: "菜单图标",
    el: "icon-picker",
    required: true
  },
  {
    field: "parentId",
    label: "上级菜单",
    el: "input"
  },
  {
    field: "orderNum",
    label: "显示排序",
    el: "number",
    elProps: {
      controlsPosition: "right",
      precision: 0,
      style: {
        width: "100%"
      }
    }
  }
];

export const processSchemas: SchemaProps[] = [
  {
    field: "processName",
    label: "流程名称",
    disabled: true,
    required: true
  },
  {
    field: "versionTag",
    label: "版本标签"
  }
];
